<?php


abstract class BaseTabHistoriaMedica extends BaseObject  implements Persistent {


	
	protected static $peer;


	
	protected $nro_historia;


	
	protected $fecha_apertura;


	
	protected $nacionalidad;


	
	protected $cedula;


	
	protected $cf_familiar;


	
	protected $nombre_pariente;


	
	protected $apellido_pariente;


	
	protected $codigo_celu;


	
	protected $tlf_celu_pariente;


	
	protected $codigo_area;


	
	protected $tlf_hab_parient;


	
	protected $direcc_pariente;


	
	protected $relacion_sexual;


	
	protected $vida_sexual;


	
	protected $observacion_general;


	
	protected $observacion_media;


	
	protected $ta;


	
	protected $pulso;


	
	protected $talla;


	
	protected $peso;


	
	protected $grupo_sanguineo;


	
	protected $factor_rh;


	
	protected $examen_funcional;


	
	protected $examen_fisico;


	
	protected $motivo_admision;


	
	protected $diagnostico;


	
	protected $estatus;

	
	protected $aTabFamiliares;

	
	protected $alreadyInSave = false;

	
	protected $alreadyInValidation = false;

	
	public function getNroHistoria()
	{

		return $this->nro_historia;
	}

	
	public function getFechaApertura($format = 'Y-m-d')
	{

		if ($this->fecha_apertura === null || $this->fecha_apertura === '') {
			return null;
		} elseif (!is_int($this->fecha_apertura)) {
						$ts = strtotime($this->fecha_apertura);
			if ($ts === -1 || $ts === false) { 				throw new PropelException("Unable to parse value of [fecha_apertura] as date/time value: " . var_export($this->fecha_apertura, true));
			}
		} else {
			$ts = $this->fecha_apertura;
		}
		if ($format === null) {
			return $ts;
		} elseif (strpos($format, '%') !== false) {
			return strftime($format, $ts);
		} else {
			return date($format, $ts);
		}
	}

	
	public function getNacionalidad()
	{

		return $this->nacionalidad;
	}

	
	public function getCedula()
	{

		return $this->cedula;
	}

	
	public function getCfFamiliar()
	{

		return $this->cf_familiar;
	}

	
	public function getNombrePariente()
	{

		return $this->nombre_pariente;
	}

	
	public function getApellidoPariente()
	{

		return $this->apellido_pariente;
	}

	
	public function getCodigoCelu()
	{

		return $this->codigo_celu;
	}

	
	public function getTlfCeluPariente()
	{

		return $this->tlf_celu_pariente;
	}

	
	public function getCodigoArea()
	{

		return $this->codigo_area;
	}

	
	public function getTlfHabParient()
	{

		return $this->tlf_hab_parient;
	}

	
	public function getDireccPariente()
	{

		return $this->direcc_pariente;
	}

	
	public function getRelacionSexual()
	{

		return $this->relacion_sexual;
	}

	
	public function getVidaSexual()
	{

		return $this->vida_sexual;
	}

	
	public function getObservacionGeneral()
	{

		return $this->observacion_general;
	}

	
	public function getObservacionMedia()
	{

		return $this->observacion_media;
	}

	
	public function getTa()
	{

		return $this->ta;
	}

	
	public function getPulso()
	{

		return $this->pulso;
	}

	
	public function getTalla()
	{

		return $this->talla;
	}

	
	public function getPeso()
	{

		return $this->peso;
	}

	
	public function getGrupoSanguineo()
	{

		return $this->grupo_sanguineo;
	}

	
	public function getFactorRh()
	{

		return $this->factor_rh;
	}

	
	public function getExamenFuncional()
	{

		return $this->examen_funcional;
	}

	
	public function getExamenFisico()
	{

		return $this->examen_fisico;
	}

	
	public function getMotivoAdmision()
	{

		return $this->motivo_admision;
	}

	
	public function getDiagnostico()
	{

		return $this->diagnostico;
	}

	
	public function getEstatus()
	{

		return $this->estatus;
	}

	
	public function setNroHistoria($v)
	{

						if ($v !== null && !is_string($v)) {
			$v = (string) $v; 
		}

		if ($this->nro_historia !== $v) {
			$this->nro_historia = $v;
			$this->modifiedColumns[] = TabHistoriaMedicaPeer::NRO_HISTORIA;
		}

	} 
	
	public function setFechaApertura($v)
	{

		if ($v !== null && !is_int($v)) {
			$ts = strtotime($v);
			if ($ts === -1 || $ts === false) { 				throw new PropelException("Unable to parse date/time value for [fecha_apertura] from input: " . var_export($v, true));
			}
		} else {
			$ts = $v;
		}
		if ($this->fecha_apertura !== $ts) {
			$this->fecha_apertura = $ts;
			$this->modifiedColumns[] = TabHistoriaMedicaPeer::FECHA_APERTURA;
		}

	} 
	
	public function setNacionalidad($v)
	{

						if ($v !== null && !is_string($v)) {
			$v = (string) $v; 
		}

		if ($this->nacionalidad !== $v) {
			$this->nacionalidad = $v;
			$this->modifiedColumns[] = TabHistoriaMedicaPeer::NACIONALIDAD;
		}

	} 
	
	public function setCedula($v)
	{

						if ($v !== null && !is_string($v)) {
			$v = (string) $v; 
		}

		if ($this->cedula !== $v) {
			$this->cedula = $v;
			$this->modifiedColumns[] = TabHistoriaMedicaPeer::CEDULA;
		}

	} 
	
	public function setCfFamiliar($v)
	{

						if ($v !== null && !is_string($v)) {
			$v = (string) $v; 
		}

		if ($this->cf_familiar !== $v) {
			$this->cf_familiar = $v;
			$this->modifiedColumns[] = TabHistoriaMedicaPeer::CF_FAMILIAR;
		}

		if ($this->aTabFamiliares !== null && $this->aTabFamiliares->getIdFamiliar() !== $v) {
			$this->aTabFamiliares = null;
		}

	} 
	
	public function setNombrePariente($v)
	{

						if ($v !== null && !is_string($v)) {
			$v = (string) $v; 
		}

		if ($this->nombre_pariente !== $v) {
			$this->nombre_pariente = $v;
			$this->modifiedColumns[] = TabHistoriaMedicaPeer::NOMBRE_PARIENTE;
		}

	} 
	
	public function setApellidoPariente($v)
	{

						if ($v !== null && !is_string($v)) {
			$v = (string) $v; 
		}

		if ($this->apellido_pariente !== $v) {
			$this->apellido_pariente = $v;
			$this->modifiedColumns[] = TabHistoriaMedicaPeer::APELLIDO_PARIENTE;
		}

	} 
	
	public function setCodigoCelu($v)
	{

						if ($v !== null && !is_string($v)) {
			$v = (string) $v; 
		}

		if ($this->codigo_celu !== $v) {
			$this->codigo_celu = $v;
			$this->modifiedColumns[] = TabHistoriaMedicaPeer::CODIGO_CELU;
		}

	} 
	
	public function setTlfCeluPariente($v)
	{

						if ($v !== null && !is_string($v)) {
			$v = (string) $v; 
		}

		if ($this->tlf_celu_pariente !== $v) {
			$this->tlf_celu_pariente = $v;
			$this->modifiedColumns[] = TabHistoriaMedicaPeer::TLF_CELU_PARIENTE;
		}

	} 
	
	public function setCodigoArea($v)
	{

						if ($v !== null && !is_string($v)) {
			$v = (string) $v; 
		}

		if ($this->codigo_area !== $v) {
			$this->codigo_area = $v;
			$this->modifiedColumns[] = TabHistoriaMedicaPeer::CODIGO_AREA;
		}

	} 
	
	public function setTlfHabParient($v)
	{

						if ($v !== null && !is_string($v)) {
			$v = (string) $v; 
		}

		if ($this->tlf_hab_parient !== $v) {
			$this->tlf_hab_parient = $v;
			$this->modifiedColumns[] = TabHistoriaMedicaPeer::TLF_HAB_PARIENT;
		}

	} 
	
	public function setDireccPariente($v)
	{

						if ($v !== null && !is_string($v)) {
			$v = (string) $v; 
		}

		if ($this->direcc_pariente !== $v) {
			$this->direcc_pariente = $v;
			$this->modifiedColumns[] = TabHistoriaMedicaPeer::DIRECC_PARIENTE;
		}

	} 
	
	public function setRelacionSexual($v)
	{

						if ($v !== null && !is_string($v)) {
			$v = (string) $v; 
		}

		if ($this->relacion_sexual !== $v) {
			$this->relacion_sexual = $v;
			$this->modifiedColumns[] = TabHistoriaMedicaPeer::RELACION_SEXUAL;
		}

	} 
	
	public function setVidaSexual($v)
	{

						if ($v !== null && !is_string($v)) {
			$v = (string) $v; 
		}

		if ($this->vida_sexual !== $v) {
			$this->vida_sexual = $v;
			$this->modifiedColumns[] = TabHistoriaMedicaPeer::VIDA_SEXUAL;
		}

	} 
	
	public function setObservacionGeneral($v)
	{

						if ($v !== null && !is_string($v)) {
			$v = (string) $v; 
		}

		if ($this->observacion_general !== $v) {
			$this->observacion_general = $v;
			$this->modifiedColumns[] = TabHistoriaMedicaPeer::OBSERVACION_GENERAL;
		}

	} 
	
	public function setObservacionMedia($v)
	{

						if ($v !== null && !is_string($v)) {
			$v = (string) $v; 
		}

		if ($this->observacion_media !== $v) {
			$this->observacion_media = $v;
			$this->modifiedColumns[] = TabHistoriaMedicaPeer::OBSERVACION_MEDIA;
		}

	} 
	
	public function setTa($v)
	{

						if ($v !== null && !is_int($v) && is_numeric($v)) {
			$v = (int) $v;
		}

		if ($this->ta !== $v) {
			$this->ta = $v;
			$this->modifiedColumns[] = TabHistoriaMedicaPeer::TA;
		}

	} 
	
	public function setPulso($v)
	{

						if ($v !== null && !is_int($v) && is_numeric($v)) {
			$v = (int) $v;
		}

		if ($this->pulso !== $v) {
			$this->pulso = $v;
			$this->modifiedColumns[] = TabHistoriaMedicaPeer::PULSO;
		}

	} 
	
	public function setTalla($v)
	{

		if ($this->talla !== $v) {
			$this->talla = $v;
			$this->modifiedColumns[] = TabHistoriaMedicaPeer::TALLA;
		}

	} 
	
	public function setPeso($v)
	{

		if ($this->peso !== $v) {
			$this->peso = $v;
			$this->modifiedColumns[] = TabHistoriaMedicaPeer::PESO;
		}

	} 
	
	public function setGrupoSanguineo($v)
	{

						if ($v !== null && !is_string($v)) {
			$v = (string) $v; 
		}

		if ($this->grupo_sanguineo !== $v) {
			$this->grupo_sanguineo = $v;
			$this->modifiedColumns[] = TabHistoriaMedicaPeer::GRUPO_SANGUINEO;
		}

	} 
	
	public function setFactorRh($v)
	{

						if ($v !== null && !is_string($v)) {
			$v = (string) $v; 
		}

		if ($this->factor_rh !== $v) {
			$this->factor_rh = $v;
			$this->modifiedColumns[] = TabHistoriaMedicaPeer::FACTOR_RH;
		}

	} 
	
	public function setExamenFuncional($v)
	{

						if ($v !== null && !is_string($v)) {
			$v = (string) $v; 
		}

		if ($this->examen_funcional !== $v) {
			$this->examen_funcional = $v;
			$this->modifiedColumns[] = TabHistoriaMedicaPeer::EXAMEN_FUNCIONAL;
		}

	} 
	
	public function setExamenFisico($v)
	{

						if ($v !== null && !is_string($v)) {
			$v = (string) $v; 
		}

		if ($this->examen_fisico !== $v) {
			$this->examen_fisico = $v;
			$this->modifiedColumns[] = TabHistoriaMedicaPeer::EXAMEN_FISICO;
		}

	} 
	
	public function setMotivoAdmision($v)
	{

						if ($v !== null && !is_string($v)) {
			$v = (string) $v; 
		}

		if ($this->motivo_admision !== $v) {
			$this->motivo_admision = $v;
			$this->modifiedColumns[] = TabHistoriaMedicaPeer::MOTIVO_ADMISION;
		}

	} 
	
	public function setDiagnostico($v)
	{

						if ($v !== null && !is_string($v)) {
			$v = (string) $v; 
		}

		if ($this->diagnostico !== $v) {
			$this->diagnostico = $v;
			$this->modifiedColumns[] = TabHistoriaMedicaPeer::DIAGNOSTICO;
		}

	} 
	
	public function setEstatus($v)
	{

						if ($v !== null && !is_string($v)) {
			$v = (string) $v; 
		}

		if ($this->estatus !== $v) {
			$this->estatus = $v;
			$this->modifiedColumns[] = TabHistoriaMedicaPeer::ESTATUS;
		}

	} 
	
	public function hydrate(ResultSet $rs, $startcol = 1)
	{
		try {

			$this->nro_historia = $rs->getString($startcol + 0);

			$this->fecha_apertura = $rs->getDate($startcol + 1, null);

			$this->nacionalidad = $rs->getString($startcol + 2);

			$this->cedula = $rs->getString($startcol + 3);

			$this->cf_familiar = $rs->getString($startcol + 4);

			$this->nombre_pariente = $rs->getString($startcol + 5);

			$this->apellido_pariente = $rs->getString($startcol + 6);

			$this->codigo_celu = $rs->getString($startcol + 7);

			$this->tlf_celu_pariente = $rs->getString($startcol + 8);

			$this->codigo_area = $rs->getString($startcol + 9);

			$this->tlf_hab_parient = $rs->getString($startcol + 10);

			$this->direcc_pariente = $rs->getString($startcol + 11);

			$this->relacion_sexual = $rs->getString($startcol + 12);

			$this->vida_sexual = $rs->getString($startcol + 13);

			$this->observacion_general = $rs->getString($startcol + 14);

			$this->observacion_media = $rs->getString($startcol + 15);

			$this->ta = $rs->getInt($startcol + 16);

			$this->pulso = $rs->getInt($startcol + 17);

			$this->talla = $rs->getFloat($startcol + 18);

			$this->peso = $rs->getFloat($startcol + 19);

			$this->grupo_sanguineo = $rs->getString($startcol + 20);

			$this->factor_rh = $rs->getString($startcol + 21);

			$this->examen_funcional = $rs->getString($startcol + 22);

			$this->examen_fisico = $rs->getString($startcol + 23);

			$this->motivo_admision = $rs->getString($startcol + 24);

			$this->diagnostico = $rs->getString($startcol + 25);

			$this->estatus = $rs->getString($startcol + 26);

			$this->resetModified();

			$this->setNew(false);

						return $startcol + 27; 
		} catch (Exception $e) {
			throw new PropelException("Error populating TabHistoriaMedica object", $e);
		}
	}

	
	public function delete($con = null)
	{
		if ($this->isDeleted()) {
			throw new PropelException("This object has already been deleted.");
		}

		if ($con === null) {
			$con = Propel::getConnection(TabHistoriaMedicaPeer::DATABASE_NAME);
		}

		try {
			$con->begin();
			TabHistoriaMedicaPeer::doDelete($this, $con);
			$this->setDeleted(true);
			$con->commit();
		} catch (PropelException $e) {
			$con->rollback();
			throw $e;
		}
	}

	
	public function save($con = null)
	{
		if ($this->isDeleted()) {
			throw new PropelException("You cannot save an object that has been deleted.");
		}

		if ($con === null) {
			$con = Propel::getConnection(TabHistoriaMedicaPeer::DATABASE_NAME);
		}

		try {
			$con->begin();
			$affectedRows = $this->doSave($con);
			$con->commit();
			return $affectedRows;
		} catch (PropelException $e) {
			$con->rollback();
			throw $e;
		}
	}

	
	protected function doSave($con)
	{
		$affectedRows = 0; 		if (!$this->alreadyInSave) {
			$this->alreadyInSave = true;


												
			if ($this->aTabFamiliares !== null) {
				if ($this->aTabFamiliares->isModified()) {
					$affectedRows += $this->aTabFamiliares->save($con);
				}
				$this->setTabFamiliares($this->aTabFamiliares);
			}


						if ($this->isModified()) {
				if ($this->isNew()) {
					$pk = TabHistoriaMedicaPeer::doInsert($this, $con);
					$affectedRows += 1; 										 										 
					$this->setNroHistoria($pk);  
					$this->setNew(false);
				} else {
					$affectedRows += TabHistoriaMedicaPeer::doUpdate($this, $con);
				}
				$this->resetModified(); 			}

			$this->alreadyInSave = false;
		}
		return $affectedRows;
	} 
	
	protected $validationFailures = array();

	
	public function getValidationFailures()
	{
		return $this->validationFailures;
	}

	
	public function validate($columns = null)
	{
		$res = $this->doValidate($columns);
		if ($res === true) {
			$this->validationFailures = array();
			return true;
		} else {
			$this->validationFailures = $res;
			return false;
		}
	}

	
	protected function doValidate($columns = null)
	{
		if (!$this->alreadyInValidation) {
			$this->alreadyInValidation = true;
			$retval = null;

			$failureMap = array();


												
			if ($this->aTabFamiliares !== null) {
				if (!$this->aTabFamiliares->validate($columns)) {
					$failureMap = array_merge($failureMap, $this->aTabFamiliares->getValidationFailures());
				}
			}


			if (($retval = TabHistoriaMedicaPeer::doValidate($this, $columns)) !== true) {
				$failureMap = array_merge($failureMap, $retval);
			}



			$this->alreadyInValidation = false;
		}

		return (!empty($failureMap) ? $failureMap : true);
	}

	
	public function getByName($name, $type = BasePeer::TYPE_PHPNAME)
	{
		$pos = TabHistoriaMedicaPeer::translateFieldName($name, $type, BasePeer::TYPE_NUM);
		return $this->getByPosition($pos);
	}

	
	public function getByPosition($pos)
	{
		switch($pos) {
			case 0:
				return $this->getNroHistoria();
				break;
			case 1:
				return $this->getFechaApertura();
				break;
			case 2:
				return $this->getNacionalidad();
				break;
			case 3:
				return $this->getCedula();
				break;
			case 4:
				return $this->getCfFamiliar();
				break;
			case 5:
				return $this->getNombrePariente();
				break;
			case 6:
				return $this->getApellidoPariente();
				break;
			case 7:
				return $this->getCodigoCelu();
				break;
			case 8:
				return $this->getTlfCeluPariente();
				break;
			case 9:
				return $this->getCodigoArea();
				break;
			case 10:
				return $this->getTlfHabParient();
				break;
			case 11:
				return $this->getDireccPariente();
				break;
			case 12:
				return $this->getRelacionSexual();
				break;
			case 13:
				return $this->getVidaSexual();
				break;
			case 14:
				return $this->getObservacionGeneral();
				break;
			case 15:
				return $this->getObservacionMedia();
				break;
			case 16:
				return $this->getTa();
				break;
			case 17:
				return $this->getPulso();
				break;
			case 18:
				return $this->getTalla();
				break;
			case 19:
				return $this->getPeso();
				break;
			case 20:
				return $this->getGrupoSanguineo();
				break;
			case 21:
				return $this->getFactorRh();
				break;
			case 22:
				return $this->getExamenFuncional();
				break;
			case 23:
				return $this->getExamenFisico();
				break;
			case 24:
				return $this->getMotivoAdmision();
				break;
			case 25:
				return $this->getDiagnostico();
				break;
			case 26:
				return $this->getEstatus();
				break;
			default:
				return null;
				break;
		} 	}

	
	public function toArray($keyType = BasePeer::TYPE_PHPNAME)
	{
		$keys = TabHistoriaMedicaPeer::getFieldNames($keyType);
		$result = array(
			$keys[0] => $this->getNroHistoria(),
			$keys[1] => $this->getFechaApertura(),
			$keys[2] => $this->getNacionalidad(),
			$keys[3] => $this->getCedula(),
			$keys[4] => $this->getCfFamiliar(),
			$keys[5] => $this->getNombrePariente(),
			$keys[6] => $this->getApellidoPariente(),
			$keys[7] => $this->getCodigoCelu(),
			$keys[8] => $this->getTlfCeluPariente(),
			$keys[9] => $this->getCodigoArea(),
			$keys[10] => $this->getTlfHabParient(),
			$keys[11] => $this->getDireccPariente(),
			$keys[12] => $this->getRelacionSexual(),
			$keys[13] => $this->getVidaSexual(),
			$keys[14] => $this->getObservacionGeneral(),
			$keys[15] => $this->getObservacionMedia(),
			$keys[16] => $this->getTa(),
			$keys[17] => $this->getPulso(),
			$keys[18] => $this->getTalla(),
			$keys[19] => $this->getPeso(),
			$keys[20] => $this->getGrupoSanguineo(),
			$keys[21] => $this->getFactorRh(),
			$keys[22] => $this->getExamenFuncional(),
			$keys[23] => $this->getExamenFisico(),
			$keys[24] => $this->getMotivoAdmision(),
			$keys[25] => $this->getDiagnostico(),
			$keys[26] => $this->getEstatus(),
		);
		return $result;
	}

	
	public function setByName($name, $value, $type = BasePeer::TYPE_PHPNAME)
	{
		$pos = TabHistoriaMedicaPeer::translateFieldName($name, $type, BasePeer::TYPE_NUM);
		return $this->setByPosition($pos, $value);
	}

	
	public function setByPosition($pos, $value)
	{
		switch($pos) {
			case 0:
				$this->setNroHistoria($value);
				break;
			case 1:
				$this->setFechaApertura($value);
				break;
			case 2:
				$this->setNacionalidad($value);
				break;
			case 3:
				$this->setCedula($value);
				break;
			case 4:
				$this->setCfFamiliar($value);
				break;
			case 5:
				$this->setNombrePariente($value);
				break;
			case 6:
				$this->setApellidoPariente($value);
				break;
			case 7:
				$this->setCodigoCelu($value);
				break;
			case 8:
				$this->setTlfCeluPariente($value);
				break;
			case 9:
				$this->setCodigoArea($value);
				break;
			case 10:
				$this->setTlfHabParient($value);
				break;
			case 11:
				$this->setDireccPariente($value);
				break;
			case 12:
				$this->setRelacionSexual($value);
				break;
			case 13:
				$this->setVidaSexual($value);
				break;
			case 14:
				$this->setObservacionGeneral($value);
				break;
			case 15:
				$this->setObservacionMedia($value);
				break;
			case 16:
				$this->setTa($value);
				break;
			case 17:
				$this->setPulso($value);
				break;
			case 18:
				$this->setTalla($value);
				break;
			case 19:
				$this->setPeso($value);
				break;
			case 20:
				$this->setGrupoSanguineo($value);
				break;
			case 21:
				$this->setFactorRh($value);
				break;
			case 22:
				$this->setExamenFuncional($value);
				break;
			case 23:
				$this->setExamenFisico($value);
				break;
			case 24:
				$this->setMotivoAdmision($value);
				break;
			case 25:
				$this->setDiagnostico($value);
				break;
			case 26:
				$this->setEstatus($value);
				break;
		} 	}

	
	public function fromArray($arr, $keyType = BasePeer::TYPE_PHPNAME)
	{
		$keys = TabHistoriaMedicaPeer::getFieldNames($keyType);

		if (array_key_exists($keys[0], $arr)) $this->setNroHistoria($arr[$keys[0]]);
		if (array_key_exists($keys[1], $arr)) $this->setFechaApertura($arr[$keys[1]]);
		if (array_key_exists($keys[2], $arr)) $this->setNacionalidad($arr[$keys[2]]);
		if (array_key_exists($keys[3], $arr)) $this->setCedula($arr[$keys[3]]);
		if (array_key_exists($keys[4], $arr)) $this->setCfFamiliar($arr[$keys[4]]);
		if (array_key_exists($keys[5], $arr)) $this->setNombrePariente($arr[$keys[5]]);
		if (array_key_exists($keys[6], $arr)) $this->setApellidoPariente($arr[$keys[6]]);
		if (array_key_exists($keys[7], $arr)) $this->setCodigoCelu($arr[$keys[7]]);
		if (array_key_exists($keys[8], $arr)) $this->setTlfCeluPariente($arr[$keys[8]]);
		if (array_key_exists($keys[9], $arr)) $this->setCodigoArea($arr[$keys[9]]);
		if (array_key_exists($keys[10], $arr)) $this->setTlfHabParient($arr[$keys[10]]);
		if (array_key_exists($keys[11], $arr)) $this->setDireccPariente($arr[$keys[11]]);
		if (array_key_exists($keys[12], $arr)) $this->setRelacionSexual($arr[$keys[12]]);
		if (array_key_exists($keys[13], $arr)) $this->setVidaSexual($arr[$keys[13]]);
		if (array_key_exists($keys[14], $arr)) $this->setObservacionGeneral($arr[$keys[14]]);
		if (array_key_exists($keys[15], $arr)) $this->setObservacionMedia($arr[$keys[15]]);
		if (array_key_exists($keys[16], $arr)) $this->setTa($arr[$keys[16]]);
		if (array_key_exists($keys[17], $arr)) $this->setPulso($arr[$keys[17]]);
		if (array_key_exists($keys[18], $arr)) $this->setTalla($arr[$keys[18]]);
		if (array_key_exists($keys[19], $arr)) $this->setPeso($arr[$keys[19]]);
		if (array_key_exists($keys[20], $arr)) $this->setGrupoSanguineo($arr[$keys[20]]);
		if (array_key_exists($keys[21], $arr)) $this->setFactorRh($arr[$keys[21]]);
		if (array_key_exists($keys[22], $arr)) $this->setExamenFuncional($arr[$keys[22]]);
		if (array_key_exists($keys[23], $arr)) $this->setExamenFisico($arr[$keys[23]]);
		if (array_key_exists($keys[24], $arr)) $this->setMotivoAdmision($arr[$keys[24]]);
		if (array_key_exists($keys[25], $arr)) $this->setDiagnostico($arr[$keys[25]]);
		if (array_key_exists($keys[26], $arr)) $this->setEstatus($arr[$keys[26]]);
	}

	
	public function buildCriteria()
	{
		$criteria = new Criteria(TabHistoriaMedicaPeer::DATABASE_NAME);

		if ($this->isColumnModified(TabHistoriaMedicaPeer::NRO_HISTORIA)) $criteria->add(TabHistoriaMedicaPeer::NRO_HISTORIA, $this->nro_historia);
		if ($this->isColumnModified(TabHistoriaMedicaPeer::FECHA_APERTURA)) $criteria->add(TabHistoriaMedicaPeer::FECHA_APERTURA, $this->fecha_apertura);
		if ($this->isColumnModified(TabHistoriaMedicaPeer::NACIONALIDAD)) $criteria->add(TabHistoriaMedicaPeer::NACIONALIDAD, $this->nacionalidad);
		if ($this->isColumnModified(TabHistoriaMedicaPeer::CEDULA)) $criteria->add(TabHistoriaMedicaPeer::CEDULA, $this->cedula);
		if ($this->isColumnModified(TabHistoriaMedicaPeer::CF_FAMILIAR)) $criteria->add(TabHistoriaMedicaPeer::CF_FAMILIAR, $this->cf_familiar);
		if ($this->isColumnModified(TabHistoriaMedicaPeer::NOMBRE_PARIENTE)) $criteria->add(TabHistoriaMedicaPeer::NOMBRE_PARIENTE, $this->nombre_pariente);
		if ($this->isColumnModified(TabHistoriaMedicaPeer::APELLIDO_PARIENTE)) $criteria->add(TabHistoriaMedicaPeer::APELLIDO_PARIENTE, $this->apellido_pariente);
		if ($this->isColumnModified(TabHistoriaMedicaPeer::CODIGO_CELU)) $criteria->add(TabHistoriaMedicaPeer::CODIGO_CELU, $this->codigo_celu);
		if ($this->isColumnModified(TabHistoriaMedicaPeer::TLF_CELU_PARIENTE)) $criteria->add(TabHistoriaMedicaPeer::TLF_CELU_PARIENTE, $this->tlf_celu_pariente);
		if ($this->isColumnModified(TabHistoriaMedicaPeer::CODIGO_AREA)) $criteria->add(TabHistoriaMedicaPeer::CODIGO_AREA, $this->codigo_area);
		if ($this->isColumnModified(TabHistoriaMedicaPeer::TLF_HAB_PARIENT)) $criteria->add(TabHistoriaMedicaPeer::TLF_HAB_PARIENT, $this->tlf_hab_parient);
		if ($this->isColumnModified(TabHistoriaMedicaPeer::DIRECC_PARIENTE)) $criteria->add(TabHistoriaMedicaPeer::DIRECC_PARIENTE, $this->direcc_pariente);
		if ($this->isColumnModified(TabHistoriaMedicaPeer::RELACION_SEXUAL)) $criteria->add(TabHistoriaMedicaPeer::RELACION_SEXUAL, $this->relacion_sexual);
		if ($this->isColumnModified(TabHistoriaMedicaPeer::VIDA_SEXUAL)) $criteria->add(TabHistoriaMedicaPeer::VIDA_SEXUAL, $this->vida_sexual);
		if ($this->isColumnModified(TabHistoriaMedicaPeer::OBSERVACION_GENERAL)) $criteria->add(TabHistoriaMedicaPeer::OBSERVACION_GENERAL, $this->observacion_general);
		if ($this->isColumnModified(TabHistoriaMedicaPeer::OBSERVACION_MEDIA)) $criteria->add(TabHistoriaMedicaPeer::OBSERVACION_MEDIA, $this->observacion_media);
		if ($this->isColumnModified(TabHistoriaMedicaPeer::TA)) $criteria->add(TabHistoriaMedicaPeer::TA, $this->ta);
		if ($this->isColumnModified(TabHistoriaMedicaPeer::PULSO)) $criteria->add(TabHistoriaMedicaPeer::PULSO, $this->pulso);
		if ($this->isColumnModified(TabHistoriaMedicaPeer::TALLA)) $criteria->add(TabHistoriaMedicaPeer::TALLA, $this->talla);
		if ($this->isColumnModified(TabHistoriaMedicaPeer::PESO)) $criteria->add(TabHistoriaMedicaPeer::PESO, $this->peso);
		if ($this->isColumnModified(TabHistoriaMedicaPeer::GRUPO_SANGUINEO)) $criteria->add(TabHistoriaMedicaPeer::GRUPO_SANGUINEO, $this->grupo_sanguineo);
		if ($this->isColumnModified(TabHistoriaMedicaPeer::FACTOR_RH)) $criteria->add(TabHistoriaMedicaPeer::FACTOR_RH, $this->factor_rh);
		if ($this->isColumnModified(TabHistoriaMedicaPeer::EXAMEN_FUNCIONAL)) $criteria->add(TabHistoriaMedicaPeer::EXAMEN_FUNCIONAL, $this->examen_funcional);
		if ($this->isColumnModified(TabHistoriaMedicaPeer::EXAMEN_FISICO)) $criteria->add(TabHistoriaMedicaPeer::EXAMEN_FISICO, $this->examen_fisico);
		if ($this->isColumnModified(TabHistoriaMedicaPeer::MOTIVO_ADMISION)) $criteria->add(TabHistoriaMedicaPeer::MOTIVO_ADMISION, $this->motivo_admision);
		if ($this->isColumnModified(TabHistoriaMedicaPeer::DIAGNOSTICO)) $criteria->add(TabHistoriaMedicaPeer::DIAGNOSTICO, $this->diagnostico);
		if ($this->isColumnModified(TabHistoriaMedicaPeer::ESTATUS)) $criteria->add(TabHistoriaMedicaPeer::ESTATUS, $this->estatus);

		return $criteria;
	}

	
	public function buildPkeyCriteria()
	{
		$criteria = new Criteria(TabHistoriaMedicaPeer::DATABASE_NAME);

		$criteria->add(TabHistoriaMedicaPeer::NRO_HISTORIA, $this->nro_historia);

		return $criteria;
	}

	
	public function getPrimaryKey()
	{
		return $this->getNroHistoria();
	}

	
	public function setPrimaryKey($key)
	{
		$this->setNroHistoria($key);
	}

	
	public function copyInto($copyObj, $deepCopy = false)
	{

		$copyObj->setFechaApertura($this->fecha_apertura);

		$copyObj->setNacionalidad($this->nacionalidad);

		$copyObj->setCedula($this->cedula);

		$copyObj->setCfFamiliar($this->cf_familiar);

		$copyObj->setNombrePariente($this->nombre_pariente);

		$copyObj->setApellidoPariente($this->apellido_pariente);

		$copyObj->setCodigoCelu($this->codigo_celu);

		$copyObj->setTlfCeluPariente($this->tlf_celu_pariente);

		$copyObj->setCodigoArea($this->codigo_area);

		$copyObj->setTlfHabParient($this->tlf_hab_parient);

		$copyObj->setDireccPariente($this->direcc_pariente);

		$copyObj->setRelacionSexual($this->relacion_sexual);

		$copyObj->setVidaSexual($this->vida_sexual);

		$copyObj->setObservacionGeneral($this->observacion_general);

		$copyObj->setObservacionMedia($this->observacion_media);

		$copyObj->setTa($this->ta);

		$copyObj->setPulso($this->pulso);

		$copyObj->setTalla($this->talla);

		$copyObj->setPeso($this->peso);

		$copyObj->setGrupoSanguineo($this->grupo_sanguineo);

		$copyObj->setFactorRh($this->factor_rh);

		$copyObj->setExamenFuncional($this->examen_funcional);

		$copyObj->setExamenFisico($this->examen_fisico);

		$copyObj->setMotivoAdmision($this->motivo_admision);

		$copyObj->setDiagnostico($this->diagnostico);

		$copyObj->setEstatus($this->estatus);


		$copyObj->setNew(true);

		$copyObj->setNroHistoria(NULL); 
	}

	
	public function copy($deepCopy = false)
	{
				$clazz = get_class($this);
		$copyObj = new $clazz();
		$this->copyInto($copyObj, $deepCopy);
		return $copyObj;
	}

	
	public function getPeer()
	{
		if (self::$peer === null) {
			self::$peer = new TabHistoriaMedicaPeer();
		}
		return self::$peer;
	}

	
	public function setTabFamiliares($v)
	{


		if ($v === null) {
			$this->setCfFamiliar(NULL);
		} else {
			$this->setCfFamiliar($v->getIdFamiliar());
		}


		$this->aTabFamiliares = $v;
	}


	
	public function getTabFamiliares($con = null)
	{
				include_once 'lib/model/om/BaseTabFamiliaresPeer.php';

		if ($this->aTabFamiliares === null && (($this->cf_familiar !== "" && $this->cf_familiar !== null))) {

			$this->aTabFamiliares = TabFamiliaresPeer::retrieveByPK($this->cf_familiar, $con);

			
		}
		return $this->aTabFamiliares;
	}

} 